<template>
	<view class="main" :style="'top:'+(-demo.height-demo.top-10)+'px'">
		<view :style="'padding-top:'+(demo.height+demo.top+10)+'px'">
			<head1 class="nav_top"
				:style="'height:' +  demo.height + 'px;' + 'padding-top:' + demo.top + 'px;padding-bottom:10px'"
				:nav="title">
			</head1>
		</view>
		<view class="jobSeek">
			<view class="">
				<textarea value="" v-model="dataList.intention" placeholder="请输入你的求职意向" placeholder-style="color:#999999"/>
			</view>
			<view class="jobSeek_bottom">
				<view class="">示例： </view>
				<view class="">我希望从事****工作......</view>
			</view>
			<view class="jobSeek_btn" @click="setResumeIntePut(dataList)">
				保存
			</view>
		</view>
		
	</view>
</template>

<script>
		import head1 from '../../common/head/head'
	export default {
		components: {
			head1
		},
		data() {
			return {
				title: '求职意向',
				demo: {
					top: '',
					height: ''
				},
				dataList:'',
				resumeId:''
			}
		},
		onLoad(option) {
			this.dataList=JSON.parse(decodeURIComponent(option.data))
		},
		created() {
			const demo = uni.getMenuButtonBoundingClientRect()
			this.demo.top = demo.top
			this.demo.height = demo.height
			this.resumeId=this.$store.state.resumeId
		},
		methods: {
			setResumeIntePut(data){
				if(data.intention!=null && data.intention!=''){
					this.$myResquest.setIntentionPut({
						resumeId:data.resumeId,
						intention:data.intention
					}).then(res=>{
						if(res.data.code==200){
							uni.showToast({
								title:"操作成功！"
							})
							setTimeout(()=>{
								// 获取页面栈
								let pages = getCurrentPages()
								// 获取上一页栈
								let prevPage = pages[pages.length - 2]
								prevPage.$vm.test()
								uni.navigateBack()
							},1000)
						}else{
							uni.showToast({
								title:"操作失败！",
								icon:'none'
							})
						}
					})
				}else{
					uni.showToast({
						title:'内容不能为空',
						icon:'none'
					})
				}
			
			}
		}
	}
</script>

<style lang="scss" scoped>
.jobSeek{
	>view{
		width: 664rpx;
		height: 412rpx;
		background: #f7f7f7;
		border-radius: 5rpx;
		margin: 34rpx 43rpx;
		padding: 28rpx 14rpx;
	}
	.jobSeek_bottom{
		background: #f4f4f4;
		height: 240rpx;
	}
	.jobSeek_btn{
		padding: 0;
		width: 600rpx;
		height: 88rpx;
		line-height: 88rpx;
		background: #5cd1ce;
		border-radius: 44rpx;
		font-family: PingFang SC, PingFang SC-Medium;
		font-weight: 500;
		text-align: center;
		color: #ffffff;
		margin: 0 auto;
	}
}
</style>
